
import QtQuick 2.8
import QtGraphicalEffects 1.0 

Item {
    id: background
    property string type: config.type
    property string color: config.color
    property string background: config.background
    property alias blur: backgroundBlur

    readonly property bool isColor: type != "image"

    Rectangle {
        id: colorBG
        anchors.fill: parent
        visible: isColor
        color: background.color
    }

    Image {
        id: imageBG
        anchors.fill: parent
        visible: !isColor
        source: "../../" + background.background
        asynchronous: true
        cache: true
        smooth: true
        mipmap: true
        fillMode: Image.PreserveAspectCrop  
    }

    FastBlur {
        id: backgroundBlur
        anchors.fill: imageBG
        source: imageBG
        visible: isColor ? false : (config["background.blur"] == "true")
        radius: visible ? config["background.blur.intensity"] : 0

        Behavior on radius {
            NumberAnimation {
                duration: 50
            }
        }
    }

    Image {
        id: imageLogo
        anchors {
            horizontalCenter: parent.horizontalCenter
            bottom: parent.bottom
            bottomMargin: 56
        }
        asynchronous: true
        cache: true
        smooth: true
        mipmap: true
        source: "../../logo_kit_black.png"
    }

}
